package com.xoa.service.attendance.attendanceway.impl;

import com.xoa.dao.attendance.attendanceway.AttendanceWayMapper;
import com.xoa.service.attendance.attendanceway.AttendanceWayService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AttendanceWayServiceImpl implements AttendanceWayService {
    @Autowired
    private AttendanceWayMapper attendanceWayMapper;
    @Override
    public ToJson getDutyMachine() {
        ToJson toJson=new ToJson();
        String rerult=attendanceWayMapper.getDutyMachine();
        if(rerult!=null) {
            toJson.setObject(rerult);
            toJson.setMsg("查询成功");
            toJson.setFlag(0);
        }else{
            toJson.setMsg("查询失败");
            toJson.setFlag(1);
        }
        return toJson;
    }

    /**
     * 修改考勤方式
     * @param dutyMachine
     * @return
     */
    @Override
    public ToJson updateDutyMachine(String dutyMachine) {
        ToJson toJson=new ToJson();
        int result=attendanceWayMapper.updateDutyMachine(dutyMachine);
        if(result<1){
            toJson.setFlag(1);
            toJson.setMsg("修改失败");
        }else{
            toJson.setMsg("修改成功");
            toJson.setFlag(0);
        }
        return toJson;
    }
}
